unval.rurcut <- function(blockobj){
  for(i in names(blockobj$blocks)){
    dat <- blockobj$blocks[[i]]
    if(i == 12){ ##GUE
      dat <- dat[-which(dat =="GRSSA008113", arr.ind=T)[,"row"],]
    }
    if(i == 15){ ##MEX
      dat <- dat[-which(dat =="MCSSA000644",
                        arr.ind=T)[,"row"],]
    }
    if(i == 17){  ##MOR
      dat <- dat[-which(dat =="MSSSA001200",
                        arr.ind=T)[,"row"],]
    }
    if(i == 24){  ##SLP
      dat <- dat[-which(dat =="SPSSA001551",
                        arr.ind=T)[,"row"],]
      dat <- dat[-which(dat =="SPSSA001061",
                        arr.ind=T)[,"row"],]
      dat <- dat[-which(dat =="SPSSA002741",
                        arr.ind=T)[,"row"],]
    }
    if(i == 26){ ##SON
      dat <- dat[-which(dat =="SRSSA002143",
                        arr.ind=T)[,"row"],]
      dat <- dat[-which(dat =="SRSSA001554",
                        arr.ind=T)[,"row"],]
      dat <- dat[-which(dat =="SRSSA001566",
                        arr.ind=T)[,"row"],]
      dat <- dat[-which(dat =="SRSSA000801",
                        arr.ind=T)[,"row"],]
      dat <- dat[-which(dat =="SRSSA001390",
                        arr.ind=T)[,"row"],]
      dat <- dat[-which(dat =="SRSSA001851",
                        arr.ind=T)[,"row"],]
    }
    blockobj$blocks[[i]] <- dat
  }
  return(blockobj)
}


unval.urbcut <- function(blockobj){
  for(i in names(blockobj$blocks)){
    dat <- blockobj$blocks[[i]]
    if(i == 12){ ##GUE
      dat <- dat[-which(dat =="GRSSA007121",
                        arr.ind=T)[,"row"],]
    }
    if(i == 14){  ##JAL
      dat <- dat[-which(dat
                        =="JCSSA005951",arr.ind=T)[,"row"],]
    }
    if(i == 17){  ##MOR
      dat <-
        dat[-which(dat=="MSSSA001306",arr.ind=T)[,"row"],]
      dat <-
        dat[-which(dat=="MSSSA000512",arr.ind=T)[,"row"],]
      dat <-
        dat[-which(dat=="MSSSA000360",arr.ind=T)[,"row"],]
      dat <-
        dat[-which(dat=="MSSSA000430",arr.ind=T)[,"row"],]
      dat <-
        dat[-which(dat=="MSSSA001866",arr.ind=T)[,"row"],]
      dat <-
        dat[-which(dat=="MSSSA000751",arr.ind=T)[,"row"],]
      dat <-
        dat[-which(dat=="MSSSA001871",arr.ind=T)[,"row"],]
    }
    if(i == 26){  ##SON
      dat <-
        dat[-which(dat=="SRSSA002143",arr.ind=T)[,"row"],]
      dat <-
        dat[-which(dat=="SRSSA000026",arr.ind=T)[,"row"],]
    }
    
    ##These urban pairs were cut later, after 2nd pairs were sent.
    if(i == 12){ ##GUE
      dat <- dat[-which(dat =="GRSSA000092",
                        arr.ind=T)[,"row"],]
      dat <- dat[-which(dat =="GRSSA000174",
                        arr.ind=T)[,"row"],]
      dat <- dat[-which(dat =="GRSSA000256",
                        arr.ind=T)[,"row"],]
    }
    if(i == 15){  ##MEX
      dat <-
        dat[-which(dat=="MCSSA008180",arr.ind=T)[,"row"],]
      dat <-
        dat[-which(dat=="MCSSA007294",arr.ind=T)[,"row"],]
      dat <-
        dat[-which(dat=="MCSSA000796",arr.ind=T)[,"row"],]
    }
    if(i == 17){  ##MOR
      dat <-
        dat[-which(dat=="MSSSA001982",arr.ind=T)[,"row"],]
    }
    blockobj$blocks[[i]] <- dat
  }
  return(blockobj)
}
